Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modularizes the Client class and improves test suite #413

Merged
merged 10 commits into from
Jul 5, 2022
Merged

Conversation

douglance
Copy link
Contributor

@douglance douglance commented Jun 17, 2022

What Changed

Client

  • src/client.ts has been broken up into src/client.ts, src/functions/, and src/shared/
    • This was done to make it possible to unit test the different components on the client.
    • The function types are:
      • validators
      • encoders
      • encrypters
      • requesters
      • decrypters
      • decoders

Tests

  • tests/ has been moved to src/__test__/ and renamed to e2e
    • This is because these tests no longer exist as the totality of all the tests.
    • Each test file in tests/* has had it's ending changed from .ts to .test.ts
    • Each test has been updated to be much more typesafe.
    • Many tests have been updated to be more independent, so the order of tests is less important.
      • This makes it easier to run tests alone (e.g. using test.only or it.only) for debugging.
  • Added vitest as the test runner (replaces ts-mocha / chai)
    • This is a very fast lib that has coverage reporting among other great features.
  • Adds ~90 unit tests to src/__test__/unit
    • These unit tests exercise the modularized Client code.
    • They run in ~200ms, which makes it very handy to quickly check if you're breaking things (or breaking the right things) when making changes.
  • NOTE: The quick bail from failed tests has been removed. This is because we want to avoid having any state carry over from one test to the next.
    • Instead, it is preferred to add .only onto any failing test to inspect it more closely without other tests interfering.

@GridPlus GridPlus deleted a comment from baby660122 Jun 18, 2022
@douglance douglance marked this pull request as draft June 21, 2022 15:00
@douglance douglance changed the base branch from dl/async-await to dev June 21, 2022 15:01
@douglance douglance force-pushed the dl/modularclient branch 3 times, most recently from 0926aa3 to 4c37fe9 Compare June 23, 2022 00:19
@douglance douglance marked this pull request as ready for review June 23, 2022 20:00
Copy link
Contributor

@alex-miller-0 alex-miller-0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow that was a long review 😵

Really really good rewrite!

Left various comments on small stuff

src/__test__/e2e/eth.msg.test.ts Show resolved Hide resolved
src/__test__/e2e/kv.test.ts Show resolved Hide resolved
src/client.ts Show resolved Hide resolved
src/client.ts Show resolved Hide resolved
src/client.ts Outdated Show resolved Hide resolved
src/shared/errors.ts Show resolved Hide resolved
src/shared/functions.ts Outdated Show resolved Hide resolved
src/shared/functions.ts Show resolved Hide resolved
src/shared/validators.ts Outdated Show resolved Hide resolved
src/shared/validators.ts Outdated Show resolved Hide resolved
@douglance douglance merged commit 0af6532 into dev Jul 5, 2022
@douglance douglance deleted the dl/modularclient branch July 5, 2022 13:48
@douglance douglance mentioned this pull request Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants